﻿#region Copyright information
// 
// Copyright © 2005-2013 Yongkee Cho. All rights reserved.
// 
// This code is a part of the Biological Object Library and governed under the terms of the
// GNU Lesser General  Public License (LGPL) version 2.1 which accompanies this distribution.
// For more information on the LGPL, please visit http://bol.codeplex.com/license.
// 
// - Filename: Gene.cs
// - Author: Yongkee Cho
// - Email: yongkeecho@gmail.com
// - Date Created: 2013-01-25 3:25 PM
// - Last Modified: 2013-01-25 3:59 PM
// 
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using BOL.Models.Features;
using BOL.Models.Genome;

namespace BOL.Models.MolecularInteractions
{
    /// <summary>
    /// Represents a gene.
    /// </summary>
    [DataContract]
    public class Gene : InteractorBase, ICloneable
    {
        #region Public properties

        /// <summary>Returns the chromosome.</summary>
        [DataMember]
        public Chromosome Chromosome { get; set; }

        /// <summary>Returns the cytoband.</summary>
        [DataMember]
        public CytoBand CytoBand { get; set; }

        /// <summary>Returns the gene full name.</summary>
        [DataMember]
        public string FullName { get; set; }

        /// <summary>Returns the gene type.</summary>
        [DataMember]
        public GeneType Type { get; set; }

        /// <summary>Returns the tissue type.</summary>
        [DataMember]
        public TissueTypes TissueTypes { get; set; }

        /// <summary>Returns the taxonomy ID.</summary>
        [DataMember]
        public int TaxonomyId { get; set; }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the gene class.
        /// </summary>
        public Gene(string id, string symbol, Chromosome chromosome, CytoBand cytoBand, string fullName, GeneType type, IEnumerable<string> alternatives, TissueTypes tissueTypes, int taxonomyId, IEnumerable<DbXref> dbXrefs)
            : base(id, symbol, alternatives, dbXrefs)
        {
            CytoBand = cytoBand;
            Chromosome = chromosome;
            FullName = fullName;
            Type = type;
            TissueTypes = tissueTypes;
            TaxonomyId = taxonomyId;
        }

        public Gene(string id)
            : this(id, String.Empty, null, null, String.Empty, GeneType.Unknown, Enumerable.Empty<string>(), TissueTypes.None, -1, Enumerable.Empty<DbXref>()) { }

        #endregion

        #region ICloneable implementation

        /// <summary>
        /// Creates an exact copy of current gene.
        /// </summary>
        /// <returns>Gene</returns>
        public Gene Clone()
        {
            return new Gene(Id, Name, Chromosome, CytoBand, FullName, Type, Alternatives, TissueTypes, TaxonomyId, DbXrefs);
        }

        /// <summary>
        /// Creates an exact copy of current gene as an object. 
        /// </summary>
        /// <returns>Gene</returns>
        object ICloneable.Clone()
        {
            return Clone();
        }

        #endregion
    }
}
